package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	links, err := findLinks("https://xaaef.com/")
	if err != nil {
		panic(err)
	}
	fmt.Println(links)
}

func findLinks(url string) (string, error) {
	resp, err := http.Get(url)
	if err != nil {
		return "", err
	}
	if resp.StatusCode != http.StatusOK {
		resp.Body.Close()
		return "", fmt.Errorf("getting %s: %s", url, resp.Status)
	}
	defer resp.Body.Close()
	if err != nil {
		return "", fmt.Errorf("parsing %s as HTML: %v", url, err)
	}
	all, err := ioutil.ReadAll(resp.Body)
	return string(all), err

}
